﻿using System;
using Jink.Protocol.Core.Verbs;
using System.Linq;

namespace Jink.Protocol.Media.Http
{
    internal static class HttpMethodHelper
    {
        public static String ToHttp(this Verb verb)
        {
            return verb.ToString().ToUpper();
        }

        public static Verb ToVerb(this String s)
        {
            var allVerbs = Enum.GetValues(typeof(Verb)).Cast<Verb>();
            return allVerbs.Single(v => v.ToHttp() == s);
        }
    }
}
